<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
</head>
<body>
    <div id="app">
        {{flag}}
        <div v-if="flag">
            你好
        </div>
        <button @click="change">{{msg}}</button>
        <button @click="change">{{flag ?"隐藏":"显示" }}</button>
    </div>
    
</body>
<script>
    new  Vue({
        el:"#app",
        data:{
            flag:true,//用来做判断
            msg:"隐藏"
        },
        methods:{
            change(){
                this.flag = !this.flag;
                this.msg = this.flag? "隐藏":"显示"
            }
        }
    })

</script>
</html>